package com.project.service.impl;

import com.project.bean.UserBean;
import com.project.mapper.IUserMapper;
import com.project.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements IUserService {
    @Autowired
    private IUserMapper userMapper;

    @Override
    public UserBean login(String code, String pwd) {
        return userMapper.login(code,pwd);
    }

    @Override
    public boolean addUser(UserBean user) {
        if (userMapper.findByName(user.getCode()) != null){
            return false;
        }
        userMapper.addUser(user);
        return true;
    }
}
